#include "Head.h"

void CreateDNK()
{
	int i,j;
	HumanDNK = fopen("HDNK.txt","wt");
	for (i=0;i<n;i++)
	{
		switch(rand() %4)
		{
			case 0: fprintf(HumanDNK,"A"); break;
			case 1: fprintf(HumanDNK,"T"); break;
			case 2: fprintf(HumanDNK,"G"); break;
			case 3: fprintf(HumanDNK,"C"); break;
		};
		if ((i+1) % 80 ==0) fprintf (HumanDNK,"\n");
	}

	fclose(HumanDNK);

	AnyDNK = fopen("AnyDNK.txt","wt");
	for (j=0;j<3;j++)
	{
		for (i=0;i<n;i++)
		{
			switch(rand() %4)
			{
				case 0: fprintf(AnyDNK,"A"); break;
				case 1: fprintf(AnyDNK,"T"); break;
				case 2: fprintf(AnyDNK,"G"); break;
				case 3: fprintf(AnyDNK,"C"); break;
			};
			if ((i+1) % 80 ==0) fprintf (AnyDNK,"\n");
		}
	fprintf(AnyDNK,"\n----\n");
	}
	fclose(AnyDNK);

}

char *ReadDNK(char *HD,char *AD1,char *AD2,char *AD3)
{
char s[m];
HumanDNK = fopen("HDNK.txt","rt");
AnyDNK = fopen("AnyDNK.txt","rt");

while (fscanf (HumanDNK,"%s",s) ==1)
strcat(HD,s);

while (fscanf (AnyDNK,"%s",s) ==1)
{	
	if (strcmp(s,"----")==0)
	{
		printf("\n\n");	break;
	}
	strcat(AD1,s);
}

while (fscanf (AnyDNK,"%s",s) ==1)
{	
	if (strcmp(s,"----")==0)
	{
		printf("\n\n");	break;
	}
	strcat(AD2,s);
}

while (fscanf (AnyDNK,"%s",s) ==1)
{	
	if (strcmp(s,"----")==0)
	{
		printf("\n\n");	break;
	}
}
printf("\n%s",AD3);
 fclose(HumanDNK);
  fclose(AnyDNK);
  memset(s, 0, sizeof(s));
  return (AD1,AD2,AD3,HD);
  

}